package router

import (
	"go-proxy/config"
	"net/http"
	"strings"
)

type ExactRouter struct {
}

func NewExactRouter() *ExactRouter {
	return &ExactRouter{}
}

func (e *ExactRouter) checkPath(route *config.Route, r *http.Request) bool {
	path := r.URL.Path
	if !route.IgnoreLowercase && route.Path == path {
		return true
	}

	lowerPath := strings.ToLower(path)
	lowerRoutePath := strings.ToLower(route.Path)
	return lowerPath == lowerRoutePath
}
